home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok53
/
oberon2.0
/
demos
/
sparks.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
3KB
|
127 lines
MODULE Sparks;
IMPORT g: Graphics,
I: Intuition,
sys: SYSTEM;
(* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
CONST
maxLines = 64;
erase = 0;
draw = 1;
x = 0;
y = 1;
start = 0;
end = 1;
TYPE
point = ARRAY 2 OF INTEGER; (* x,y *)
line = ARRAY 2 OF point; (* start,end *)
VAR
i: INTEGER;
ns: I.NewScreen;
screen: I.ScreenPtr;
Ciapra[0BFE001H]: SHORTSET;
lines: ARRAY maxLines OF line;
l: line;
cl: INTEGER;
color: INTEGER;
deltas: line;
w,h: INTEGER;
cols: ARRAY 2 OF INTEGER;
TYPE
ColArr = ARRAY 6*15 OF INTEGER;
CONST
colors = ColArr(0F00H,0F10H,0F20H,0F30H,0F40H,0F50H,0F60H,0F70H,0F80H,0F90H,0FA0H,0FB0H,0FC0H,0FD0H,0FE0H,
0FF0H,0EF0H,0DF0H,0CF0H,0BF0H,0AF0H,09F0H,08F0H,07F0H,06F0H,05F0H,04F0H,03F0H,02F0H,01F0H,
00F0H,00F1H,00F2H,00F3H,00F4H,00F5H,00F6H,00F7H,00F8H,00F9H,00FAH,00FBH,00FCH,00FDH,00FEH,
00FFH,00EFH,00DFH,00CFH,00BFH,00AFH,009FH,008FH,007FH,006FH,005FH,004FH,003FH,002FH,001FH,
000FH,010FH,020FH,030FH,040FH,050FH,060FH,070FH,080FH,090FH,0A0FH,0B0FH,0C0FH,0D0FH,0E0FH,
0F0FH,0F0EH,0F0DH,0F0CH,0F0BH,0F0AH,0F09H,0F08H,0F07H,0F06H,0F05H,0F04H,0F03H,0F20H,0F01H);
PROCEDURE DrawLine(l: line; color: INTEGER);
VAR rp: g.RastPortPtr;
BEGIN
rp := sys.ADR(screen.rastPort);
g.SetDrMd(rp,g.jam1);
g.SetAPen(rp,color);
g.Move(rp, l[start,x], l[start,y]);
g.Draw(rp, l[end, x], l[end, y]);
g.Draw(rp,w-l[start,x],h-l[start,y]);
g.Draw(rp,w-l[end, x],h-l[end, y]);
g.Draw(rp, l[start,x], l[start,y]);
END DrawLine;
PROCEDURE Adjust(VAR c,dc: INTEGER; max: INTEGER);
VAR
i: INTEGER;
VHPosR[0DFF006H]: SET;
BEGIN
i := dc - 8;
INC(c,i);
IF (c<0) OR (c>max) THEN
DEC(c,i);
i := sys.VAL(INTEGER,VHPosR*{0..3});
IF i>7 THEN INC(i,1) END;
dc := i;
END;
END Adjust;
BEGIN
ns.width := g.gfx.normalDisplayColumns;
ns.height := -1;
ns.depth := 1;
ns.type := I.customScreen+{I.screenQuiet};
ns.viewModes := {g.lace,g.hires};
screen := I.OpenScreen(ns);
IF screen#NIL THEN
w := screen.width-1;
h := screen.height-1;
REPEAT
cols[1] := colors[color DIV 16];
INC(color); IF color=1440 THEN color := 0 END;
g.LoadRGB4(sys.ADR(screen.viewPort),cols,2);
DrawLine(lines[cl],erase);
i := start;
REPEAT
Adjust(l[i,x],deltas[i,x],w);
Adjust(l[i,y],deltas[i,y],h);
INC(i);
UNTIL i>end;
DrawLine(l,draw);
lines[cl] := l;
INC(cl);
IF cl=maxLines THEN cl := 0 END;
UNTIL NOT(6 IN Ciapra);
I.OldCloseScreen(screen);
END
END Sparks.